package ${basePackageName}.web;

import java.io.Serializable;

import org.springframework.beans.factory.annotation.Autowired;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.Namespace;

import com.sinosoftframework.core.manager.EntityManager;
import com.sinosoftframework.core.struts2.CrudExtActionSupport;

import ${basePackageName}.domain.${className};
import ${basePackageName}.manager.${className}Manager;

@Namespace("${namespace}")
@InterceptorRefs( { @InterceptorRef("paramsPrepareParamsStack") })
public class ${className}Action extends CrudExtActionSupport<${className}, Serializable>{

	private static final long serialVersionUID = 1L;

	//注入客户管理manager层
	@Autowired
	${className}Manager manager;
	
	@Override
	protected EntityManager<${className}, Serializable> getEntityManager() {
		return manager;
	}

	//创建一个实体对象
	${className} entity;
	
	@Override
	protected void prepareModel() throws Exception {
		if(id!=null && !"".equals(id)){
			entity = manager.get(id);
		} else {
			entity = new ${className}();
		}
	}

	public ${className} getModel() {
		return entity;
	}
}